#ifndef __TIMER_A_CAPTURE_H_
#define __TIMER_A_CAPTURE_H_

#include "common_def.h"

// P1.2/TA1 is used to capture ADXL213AE accelerometer signals.
// timer A is clocked from DCO ~ 800kHz. I don't know the accurate frequency.
// ADXL213AE frequency is about 250Hz (4ms).

// Note: the cycle is 1/800kHz ~ 1.2 us.
// Note: capture handle is called in interrupt context
typedef void (*CAPTURE_HANDLER_T)(bool is_up_edge, uint16 cycle);

void timera_capture_init(void);
void timera_capture_start(CAPTURE_HANDLER_T handler);
bool timera_is_capturing(void);
void timera_capture_stop(void);

#endif // __TIMER_A_CAPTURE_H_

